﻿public class PlayerFall : PlayerBaseState {
	public PlayerFall(PlayerController controller, PlayerStateEnum stateName, State<PlayerStateEnum> superFSM, StateFactory<PlayerStateEnum> factory) : base(controller, stateName, superFSM, factory) {
		AddConditionToSelf(() => !_controller.Jump || _controller.Velocity.y <= 0);

		AddNewTransition(PlayerStateEnum.Jump, () => _controller.Jump && CanJump());
	}

	public override void Enter() {
		_controller.PlayAnim(PlayerStateEnum.Fall);
		_controller.SetGravity(_controller.ConfigData.FallAcceleration);
	}

	public override void Exit() {
		_controller.ResetGravity();
	}
	bool CanJump() => _controller.StateData.CurJumpCnt < _controller.ConfigData.MaxJumpCnt;
}